package com.dhsc.constant;

import java.util.HashMap;
import java.util.Map;

public class CasResultEnum {

	public enum CasErrorCode {
		
		
		参数错误("7001"),
		账号或密码错误("7002"),
		用户不可用("9019"),
		配置错误("9051"),
		用户不存在("9002"),
		服务内部错误("9999"),
		未知异常("");

        private static Map<String, CasErrorCode> codeToEnumMap;

        private final String code;

        CasErrorCode(String code) {
            this.code = code;
        }

        public String getCode() {
            return code;
        }


        public static CasErrorCode fromCode(String code) {
            if (codeToEnumMap == null) {
                codeToEnumMap = new HashMap<>();
                for (CasErrorCode aEnum : CasErrorCode.values()) {
                    codeToEnumMap.put(aEnum.getCode(), aEnum);
                }
            }

            return codeToEnumMap.get(code);
        }
    }
}
